#pragma once

#include "..\..\common\stdafx.h"

#include <FTGL\ftgl.h>

class TextRender
{
public:
	TextRender();
	void RenderNumber(int);
	void RenderChar(char);
	void RenderWChar(const wchar_t*);
	void RenderWString(std::wstring);
	void SetSize(int);
	void SetPoint(float,float,float);

private:
	FTPoint* m_Point1;
	FTPoint* m_Point2;
	FTBitmapFont* m_Font;
};

enum VERTEXBUFFERS
{
	BUFFER_VERTEX = 0,
	BUFFER_TEXCOORD,
	BUFFER_TRIANGLVERTEX,
	BUFFER_COUNT
};

enum TEXTURES
{
	TEXTURE_QUESTIONBOARD = 0,
	TEXTURE_COUNT

};

enum VIEWPORT
{
	VIEWPORT_RACE,
	VIEWPORT_QUESTION,
};

class SceneRender
{
public:
	SceneRender();
	~SceneRender();
	void Init();
	void Render();
	void RenderBackground();
	void RenderCar();

	void SetQuestionData(std::wstring,std::wstring,std::wstring,std::wstring);
	void SetStatData(std::wstring header,std::wstring total,std::wstring correct,std::wstring wrong);

private:
	TextRender* m_TextRender;
	bool m_RenderingQuestion;

	std::wstring m_QuestionHeader;
	std::wstring m_QuestionTitle;
	std::wstring m_QuestionOptionA;
	std::wstring m_QuestionOptionB;
	std::wstring m_StatHeader;
	std::wstring m_StatTotal;
	std::wstring m_StatCorrect;
	std::wstring m_StatWrong;

	glm::ivec4 m_Viewport[2];
	GLuint m_QuestionProgram;
	GLuint m_RaceProgram;
	GLuint m_TestProgram;
	GLuint m_VertexBuffers[BUFFER_COUNT];
	GLuint m_Textures[TEXTURE_COUNT];
	GLuint m_UniformLocationSampler2D;

	void InitProgram();
	void InitBuffer();
	void InitTexture();
	void RenderQuestion();
	void RenderStats();
	void ClearBuffers();

	void RenderSimpleTriangles();
	void SetViewport(VIEWPORT);

};